Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enabled contract upgrades and used namespaced storage #187

Merged
merged 32 commits into from
Dec 24, 2024

Conversation

srdtrk
Copy link
Member

@srdtrk srdtrk commented Dec 20, 2024

Description

closes: #188, #189


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Wrote unit and integration tests.
  • Added relevant natspec and godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

Copy link

codecov bot commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.97%. Comparing base (3b81a89) to head (21e437c).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #187      +/-   ##
==========================================
+ Coverage   96.83%   96.97%   +0.14%     
==========================================
  Files          11       11              
  Lines         537      562      +25     
==========================================
+ Hits          520      545      +25     
  Misses         17       17              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@srdtrk srdtrk marked this pull request as ready for review December 23, 2024 09:25
@srdtrk srdtrk changed the title feat: enable contract upgrades and migrations feat: enabled contract upgrades and used namespaced storage Dec 23, 2024
@srdtrk srdtrk mentioned this pull request Dec 23, 2024
6 tasks
Copy link
Contributor

@gjermundgaraba gjermundgaraba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!! We're getting closer to having the full setup running 🚀

Left a couple of questions, but I also think updating the benchmarks might be needed.

In addition, make sure that any remaining implementation work (such as doing this for the light client, and considering how to deal with IBCStore) is documented in the Epic.

/// @param escrow The escrow contract
/// @param ibcDenomContracts Mapping of non-native denoms to their respective IBCERC20 contracts
/// @custom:storage-location erc7201:ibc.storage.ICS20Transfer
struct ICS20TransferStorage {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious if this has any penalty in gas cost? Would this end up fetching more data than we need (+ use more memory) whenever we need only one of them?

I hope that the fact that it is set as a storage type helps, but still want to make sure we are not getting punished too hard for this :)

Have you tried to run the benchmarks to see if anything has changed significantly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on my understanding of solidity, this doesn't fetch more data/memory than we need, but we might be consuming more gas since we are making some extra function calls.

I updated the benchmarks and there is an increase in gas usage, but this might be due to the addition of the proxy contract, and fallback logic as well. The gas increase is not substantial in the aggregated scenario.

@@ -305,4 +340,12 @@ contract ICS26Router is IICS26Router, IICS26RouterErrors, Ownable, ReentrancyGua
}
}
}

/// @notice Returns the storage of the ICS26Router contract
function _getICS26RouterStorage() private pure returns (ICS26RouterStorage storage $) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto for this and all the other ones where we have a struct as storage

@@ -45,7 +47,31 @@ abstract contract FixtureTest is Test {
}

function setUp() public {
ics26Router = new ICS26Router(address(this));
// ============ Step 1: Deploy the logic contracts ==============
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we do this a lot, can we refactor it out somehow? Not a big deal if it is not easy, but would be nice to have a single place where we do instantiation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not easy at the moment. The ideal scenario would be to use the deploy script but I'm not sure if it could be done. Happy to review any PR that does this

@srdtrk
Copy link
Member Author

srdtrk commented Dec 24, 2024

I updated the benchmarks, I think the light client itself doesn't need upgradability or recovery since this can be done by migrating ICSCore. I'm not sure if IBCStore needs upgradability either. I think I can add a testing issue in the epic for light client recovery (through ICSCore)

@srdtrk srdtrk merged commit b77c838 into main Dec 24, 2024
58 checks passed
@srdtrk srdtrk deleted the serdar/12-migrations branch December 24, 2024 05:28
@gjermundgaraba
Copy link
Contributor

I updated the benchmarks, I think the light client itself doesn't need upgradability or recovery since this can be done by migrating ICSCore. I'm not sure if IBCStore needs upgradability either. I think I can add a testing issue in the epic for light client recovery (through ICSCore)

Let's go through the use cases, but I can imagine that it could make sense for light client upgradability to be independent of ICSCore. If multiple light clients from different chains are using the same ICSCore, independent upgradability of light clients might be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce support for upgradable contracts with ERC-1967 using openzepellin's utilities
2 participants